var curPage1 = 1;
var curPage2 = 1;
var curPage3 = 1;
var curPage4 = 1;
var curPage5 = 1;
var pageSize = 20;
var uid= window.getUrlParam('id');
var company = {
    getData: function() {
        $.ajax({
            url: window.domain + window.requestUrl.getCompanyUrl,
            type: 'get',
            xhrFields: {
                withCredentials: true
            },
            crossDomain: true,
            data: {
                uid: uid
            },
            success: function(res) {
                if(typeof(res.not_login) != 'undefined') {
                    window.setCookie('go_back_link', window.location.href);
                    window.location.href = './login.html';
                    return;
                }
                if(res.status) {
                    var result = res.data.result;
                    $('.company-top__img').prop('src', result.iconUrl);
                    $('[data-role="name"]').html(result.name);
                    $('[data-role="intro"]').html(result.intro);
                    $('[data-role="companyIntro"]').html(result.description);
                } else {
                    iosOverlay({
                        text: res.msg,
                        duration: 1000
                    });
                }
            },
            error: function(e) {
            }
        })
    },
    tab: function() {
        $('.company-tab li').on('click', function() {
            $(this).addClass('is-active').siblings().removeClass('is-active');
            var  index = $(this).index();
            $('.company-content li').eq(index).show().siblings().hide();
        })
    },
    getList1: function() {
        $.ajax({
            url: window.domain + window.requestUrl.getCompanyPlatUrl,
            type: 'get',
            data: {
                pageSize: pageSize,
                platId: 4,
                uid: uid
            },
            xhrFields: {
                withCredentials: true
            },
            crossDomain: true,
            success: function(res) {
                if(typeof(res.not_login) != 'undefined') {
                    window.setCookie('go_back_link', window.location.href);
                    window.location.href = './login.html';
                    return;
                }
                if(res.status) {
                    var pager = res.data.result;
                    company.initPaging1(pager.pages, pager.total, res);
                    $('.company-tab li').eq(0).find('span').html(pager.total);
                } else {
                    iosOverlay({
                        text: res.msg,
                        duration: 1000
                    });
                }
            },
            error: function(e) {
            }
        })
    },
    initPaging1: function(totalPage, totalDataNum, res) {
        var self = this,
            ele = $('[data-role="dirPaging1"]');
            if(totalDataNum > 0) {
                ele.show();
                var pagination = ele.pagination(totalDataNum, {
                    num_edge_entries: 1,
                    num_display_entries: 4,
                    callback: function(page_index) {
                        if(page_index == 0) {
                            var totalPage = res.data.result.pages;

                            var pageData = res.data.result.list;
                            var result = res.data.result;
                            company.randerList1(pageData);
                        } else {
                            curPage1 = page_index + 1;
                            company.getPageDates1();
                        }
                    },
                    items_per_page: pageSize,
                    prev_text: "&lt;&lt;上一页",
                    next_text: "下一页&gt;&gt;",
                    link_to: "javascript:;"
                });

            }else {
                ele.hide();
                $('[data-role="result1"]').html('<tr><td  colspan="7" style="text-align: center;line-height: 100px;font-size: 18px;">没有数据</td></tr>')
            }
    },
    getPageDates1: function() {
        var self = this;

        $.ajax({
            url: window.domain + window.requestUrl.getCompanyPlatUrl,
            type: 'get',
            data: {
                pageNum: curPage1,
                pageSize: pageSize,
                platId: 4,
                uid: uid
            },
            xhrFields: {
                withCredentials: true
            },
            crossDomain: true,
            success: function(res) {
                if(typeof(res.not_login) != 'undefined') {
                    window.setCookie('go_back_link', window.location.href);
                    window.location.href = './login.html';
                    return;
                }

                // 同步页码
                var totalPage = res.data.result.pages;

                var pageData = res.data.result.list;
                var result = res.data.result;
                self.randerList1(pageData);
            },
            error: function() {
                // console.log('分页接口失败');
            }
        });
    },
    randerList1: function(pageData) {
        var tpl = '';

        $.each(pageData, function(index, item) {
            var titleTpl = '';
            item.tags = JSON.parse(item.tags)
            if(item.tags.length > 0) {
                var tagTpl = '';
                $.each(item.tags, function(indexDir, itemDir) {
                    if(indexDir > 2) return;
                    tagTpl += tagMap[itemDir]+' ';
                })
                titleTpl = '<p>'+item.title+'</p><p class="item-desc">'+tagTpl+'</p>';
            } else {
                titleTpl = '<p style="line-height:50px;">'+item.title+'</p>';
            }
            var dangqi = '';
            if(item.hasFreeSchedInWeek) {
                dangqi = '有';
            } else {
                dangqi = '无';
            }

            var openqq = '';
            if(window.isLogin) {
                openqq = '<a href="tencent://message/?uin='+item.qq+'&Site=yoomeda.com&Menu=yes" target="_blank">\
                            <img src="http://wpa.qq.com/pa?p=2:'+item.qq+':41" alt="点击这里给我发消息" title="点击这里给我发消息">\
                        </a>';
            } else {
                openqq = '<a href="javascript:;" data-role="tologin">\
                            <img src="http://wpa.qq.com/pa?p=2:'+item.qq+':41" alt="点击这里给我发消息" title="点击这里给我发消息">\
                        </a>';
            }
            var avgReadCountReal = item.avgReadCount ? item.avgReadCount : '无';
            tpl += '<tr>\
                        <td>\
                            <div class="tr-main">\
                                <a href="./weixin-detail.html?id='+item.id+'" target="_blank">\
                                    <img src="'+item.iconUrl+'" alt="'+item.title+'">\
                                </a>\
                                <div class="tr-main__name">\
                                    <a href="./weixin-detail.html?id='+item.id+'" target="_blank">'+titleTpl+'</a>\
                                </div>\
                            </div>\
                        </td>\
                        <td>'+item.fansCount+'</td>\
                        <td>'+avgReadCountReal+'</td>\
                        <td>'+((item.price1 == -1) ? '无' : item.price1)+'</td>\
                        <td>'+((item.price2 == -1) ? '无' : item.price2)+'</td>\
                        <td>'+dangqi+'</td>\
                        <td>'+openqq+'</td>\
                    </tr>';
        })
        $('[data-role="result1"]').html(tpl);
    },


    getList2: function() {
        $.ajax({
            url: window.domain + window.requestUrl.getCompanyPlatUrl,
            type: 'get',
            data: {
                pageSize: pageSize,
                platId: 5,
                uid: uid
            },
            xhrFields: {
                withCredentials: true
            },
            crossDomain: true,
            success: function(res) {
                if(typeof(res.not_login) != 'undefined') {
                    window.setCookie('go_back_link', window.location.href);
                    window.location.href = './login.html';
                    return;
                }
                if(res.status) {
                    var pager = res.data.result;
                    company.initPaging2(pager.pages, pager.total, res);
                    $('.company-tab li').eq(1).find('span').html(pager.total);
                } else {
                    iosOverlay({
                        text: res.msg,
                        duration: 1000
                    });
                }
            },
            error: function(e) {
            }
        })
    },
    initPaging2: function(totalPage, totalDataNum, res) {
        var self = this,
            ele = $('[data-role="dirPaging2"]');
            if(totalDataNum > 0) {
                ele.show();
                var pagination = ele.pagination(totalDataNum, {
                    num_edge_entries: 1,
                    num_display_entries: 4,
                    callback: function(page_index) {
                        if(page_index == 0) {
                            var totalPage = res.data.result.pages;

                            var pageData = res.data.result.list;
                            var result = res.data.result;
                            company.randerList2(pageData);
                        } else {
                            curPage2 = page_index + 1;
                            company.getPageDates2();
                        }
                    },
                    items_per_page: pageSize,
                    prev_text: "&lt;&lt;上一页",
                    next_text: "下一页&gt;&gt;",
                    link_to: "javascript:;"
                });

            }else {
                ele.hide();
                $('[data-role="result2"]').html('<tr><td  colspan="6" style="text-align: center;line-height: 100px;font-size: 18px;">没有数据</td></tr>')
            }
    },
    getPageDates2: function() {
        var self = this;

        $.ajax({
            url: window.domain + window.requestUrl.getCompanyPlatUrl,
            type: 'get',
            data: {
                pageNum: curPage2,
                pageSize: pageSize,
                platId: 5,
                uid: uid
            },
            xhrFields: {
                withCredentials: true
            },
            crossDomain: true,
            success: function(res) {
                if(typeof(res.not_login) != 'undefined') {
                    window.setCookie('go_back_link', window.location.href);
                    window.location.href = './login.html';
                    return;
                }

                // 同步页码
                var totalPage = res.data.result.pages;

                var pageData = res.data.result.list;
                var result = res.data.result;
                self.randerList2(pageData);
            },
            error: function() {
                // console.log('分页接口失败');
            }
        });
    },
    randerList2: function(pageData) {
        var tpl = '';

        $.each(pageData, function(index, item) {
            var titleTpl = '';
            item.tags = JSON.parse(item.tags)
            if(item.tags.length > 0) {
                var tagTpl = '';
                $.each(item.tags, function(indexDir, itemDir) {
                    if(indexDir > 2) return;
                    tagTpl += tagMap[itemDir]+' ';
                })
                titleTpl = '<p>'+item.title+'</p><p class="item-desc">'+tagTpl+'</p>';
            } else {
                titleTpl = '<p style="line-height:50px;">'+item.title+'</p>';
            }
            var dangqi = '';
            if(item.hasFreeSchedInWeek) {
                dangqi = '有';
            } else {
                dangqi = '无';
            }

            var openqq = '';
            if(window.isLogin) {
                openqq = '<a href="tencent://message/?uin='+item.qq+'&Site=yoomeda.com&Menu=yes" target="_blank">\
                            <img src="http://wpa.qq.com/pa?p=2:'+item.qq+':41" alt="点击这里给我发消息" title="点击这里给我发消息">\
                        </a>';
            } else {
                openqq = '<a href="javascript:;" data-role="tologin">\
                            <img src="http://wpa.qq.com/pa?p=2:'+item.qq+':41" alt="点击这里给我发消息" title="点击这里给我发消息">\
                        </a>';
            }
            tpl += '<tr>\
                        <td>\
                            <div class="tr-main">\
                                <a href="./sina-detail.html?id='+item.id+'" target="_blank">\
                                    <img src="'+item.iconUrl+'" alt="'+item.title+'">\
                                </a>\
                                <div class="tr-main__name">\
                                    <a href="./sina-detail.html?id='+item.id+'" target="_blank">'+titleTpl+'</a>\
                                </div>\
                            </div>\
                        </td>\
                        <td>'+item.fansCount+'</td>\
                        <td>'+((item.price1 == -1) ? '无' : item.price1)+'</td>\
                        <td>'+((item.price2 == -1) ? '无' : item.price2)+'</td>\
                        <td>'+dangqi+'</td>\
                        <td>'+openqq+'</td>\
                    </tr>';
        })
        $('[data-role="result2"]').html(tpl);
    },

    getList3: function() {
        $.ajax({
            url: window.domain + window.requestUrl.getCompanyPlatUrl,
            type: 'get',
            data: {
                pageSize: pageSize,
                platId: 2,
                uid: uid
            },
            xhrFields: {
                withCredentials: true
            },
            crossDomain: true,
            success: function(res) {
                if(typeof(res.not_login) != 'undefined') {
                    window.setCookie('go_back_link', window.location.href);
                    window.location.href = './login.html';
                    return;
                }
                if(res.status) {
                    var pager = res.data.result;
                    company.initPaging3(pager.pages, pager.total, res);
                    $('.company-tab li').eq(2).find('span').html(pager.total);
                } else {
                    iosOverlay({
                        text: res.msg,
                        duration: 1000
                    });
                }
            },
            error: function(e) {
            }
        })
    },
    initPaging3: function(totalPage, totalDataNum, res) {
        var self = this,
            ele = $('[data-role="dirPaging3"]');
            if(totalDataNum > 0) {
                ele.show();
                var pagination = ele.pagination(totalDataNum, {
                    num_edge_entries: 1,
                    num_display_entries: 4,
                    callback: function(page_index) {
                        if(page_index == 0) {
                            var totalPage = res.data.result.pages;

                            var pageData = res.data.result.list;
                            var result = res.data.result;
                            company.randerList3(pageData);
                        } else {
                            curPage3 = page_index + 1;
                            company.getPageDates3();
                        }
                    },
                    items_per_page: pageSize,
                    prev_text: "&lt;&lt;上一页",
                    next_text: "下一页&gt;&gt;",
                    link_to: "javascript:;"
                });

            }else {
                ele.hide();
                $('[data-role="result3"]').html('<tr><td  colspan="7" style="text-align: center;line-height: 100px;font-size: 18px;">没有数据</td></tr>')
            }
    },
    getPageDates3: function() {
        var self = this;

        $.ajax({
            url: window.domain + window.requestUrl.getCompanyPlatUrl,
            type: 'get',
            data: {
                pageNum: curPage3,
                pageSize: pageSize,
                platId: 2,
                uid: uid
            },
            xhrFields: {
                withCredentials: true
            },
            crossDomain: true,
            success: function(res) {
                if(typeof(res.not_login) != 'undefined') {
                    window.setCookie('go_back_link', window.location.href);
                    window.location.href = './login.html';
                    return;
                }

                // 同步页码
                var totalPage = res.data.result.pages;

                var pageData = res.data.result.list;
                var result = res.data.result;
                self.randerList3(pageData);
            },
            error: function() {
                // console.log('分页接口失败');
            }
        });
    },
    randerList3: function(pageData) {
        var tpl = '';

        $.each(pageData, function(index, item) {
            var titleTpl = '';
            item.tags = JSON.parse(item.tags)
            if(item.tags.length > 0) {
                var tagTpl = '';
                $.each(item.tags, function(indexDir, itemDir) {
                    if(indexDir > 2) return;
                    tagTpl += tagMap[itemDir]+' ';
                })
                titleTpl = '<p>'+item.title+'</p><p class="item-desc">'+tagTpl+'</p>';
            } else {
                titleTpl = '<p style="line-height:50px;">'+item.title+'</p>';
            }
            var dangqi = '';
            if(item.hasFreeSchedInWeek) {
                dangqi = '有';
            } else {
                dangqi = '无';
            }

            var openqq = '';
            if(window.isLogin) {
                openqq = '<a href="tencent://message/?uin='+item.qq+'&Site=yoomeda.com&Menu=yes" target="_blank">\
                            <img src="http://wpa.qq.com/pa?p=2:'+item.qq+':41" alt="点击这里给我发消息" title="点击这里给我发消息">\
                        </a>';
            } else {
                openqq = '<a href="javascript:;" data-role="tologin">\
                            <img src="http://wpa.qq.com/pa?p=2:'+item.qq+':41" alt="点击这里给我发消息" title="点击这里给我发消息">\
                        </a>';
            }
            var avgReadCountReal = item.avgReadCount ? item.avgReadCount : '无';
            tpl += '<tr>\
                        <td>\
                            <div class="tr-main">\
                                <a href="./wanghong-detail.html?id='+item.id+'" target="_blank">\
                                    <img src="'+item.iconUrl+'" alt="'+item.title+'">\
                                </a>\
                                <div class="tr-main__name">\
                                    <a href="./wanghong-detail.html?id='+item.id+'" target="_blank">'+titleTpl+'</a>\
                                </div>\
                            </div>\
                        </td>\
                        <td>'+item.fansCount+'</td>\
                        <td>'+avgReadCountReal+'</td>\
                        <td>'+((item.price1 == -1) ? '无' : item.price1)+'</td>\
                        <td>'+((item.price2 == -1) ? '无' : item.price2)+'</td>\
                        <td>'+dangqi+'</td>\
                        <td>'+openqq+'</td>\
                    </tr>';
        })
        $('[data-role="result3"]').html(tpl);
    },

    getList4: function() {
        $.ajax({
            url: window.domain + window.requestUrl.getCompanyPlatUrl,
            type: 'get',
            data: {
                pageSize: pageSize,
                platId: 3,
                uid: uid
            },
            xhrFields: {
                withCredentials: true
            },
            crossDomain: true,
            success: function(res) {
                if(typeof(res.not_login) != 'undefined') {
                    window.setCookie('go_back_link', window.location.href);
                    window.location.href = './login.html';
                    return;
                }
                if(res.status) {
                    var pager = res.data.result;
                    company.initPaging4(pager.pages, pager.total, res);
                    $('.company-tab li').eq(3).find('span').html(pager.total);
                } else {
                    iosOverlay({
                        text: res.msg,
                        duration: 1000
                    });
                }
            },
            error: function(e) {
            }
        })
    },
    initPaging4: function(totalPage, totalDataNum, res) {
        var self = this,
            ele = $('[data-role="dirPaging4"]');
            if(totalDataNum > 0) {
                ele.show();
                var pagination = ele.pagination(totalDataNum, {
                    num_edge_entries: 1,
                    num_display_entries: 4,
                    callback: function(page_index) {
                        if(page_index == 0) {
                            var totalPage = res.data.result.pages;

                            var pageData = res.data.result.list;
                            var result = res.data.result;
                            company.randerList4(pageData);
                        } else {
                            curPage4 = page_index + 1;
                            company.getPageDates4();
                        }
                    },
                    items_per_page: pageSize,
                    prev_text: "&lt;&lt;上一页",
                    next_text: "下一页&gt;&gt;",
                    link_to: "javascript:;"
                });

            }else {
                ele.hide();
                $('[data-role="result4"]').html('<tr><td  colspan="8" style="text-align: center;line-height: 100px;font-size: 18px;">没有数据</td></tr>')
            }
    },
    getPageDates4: function() {
        var self = this;

        $.ajax({
            url: window.domain + window.requestUrl.getCompanyPlatUrl,
            type: 'get',
            data: {
                pageNum: curPage4,
                pageSize: pageSize,
                platId: 3,
                uid: uid
            },
            xhrFields: {
                withCredentials: true
            },
            crossDomain: true,
            success: function(res) {
                if(typeof(res.not_login) != 'undefined') {
                    window.setCookie('go_back_link', window.location.href);
                    window.location.href = './login.html';
                    return;
                }

                // 同步页码
                var totalPage = res.data.result.pages;

                var pageData = res.data.result.list;
                var result = res.data.result;
                self.randerList4(pageData);
            },
            error: function() {
                // console.log('分页接口失败');
            }
        });
    },
    randerList4: function(pageData) {
        var tpl = '';

        $.each(pageData, function(index, item) {
            var titleTpl = '';
            item.tags = JSON.parse(item.tags)
            if(item.tags.length > 0) {
                var tagTpl = '';
                $.each(item.tags, function(indexDir, itemDir) {
                    if(indexDir > 2) return;
                    tagTpl += tagMap[itemDir]+' ';
                })
                titleTpl = '<p>'+item.title+'</p><p class="item-desc">'+tagTpl+'</p>';
            } else {
                titleTpl = '<p style="line-height:50px;">'+item.title+'</p>';
            }
            var dangqi = '';
            if(item.hasFreeSchedInWeek) {
                dangqi = '有';
            } else {
                dangqi = '无';
            }

            var openqq = '';
            if(window.isLogin) {
                openqq = '<a href="tencent://message/?uin='+item.qq+'&Site=yoomeda.com&Menu=yes" target="_blank">\
                            <img src="http://wpa.qq.com/pa?p=2:'+item.qq+':41" alt="点击这里给我发消息" title="点击这里给我发消息">\
                        </a>';
            } else {
                openqq = '<a href="javascript:;" data-role="tologin">\
                            <img src="http://wpa.qq.com/pa?p=2:'+item.qq+':41" alt="点击这里给我发消息" title="点击这里给我发消息">\
                        </a>';
            }

            tpl += '<tr>\
                        <td>\
                            <div class="tr-main">\
                                <a href="./video-detail.html?id='+item.id+'" target="_blank">\
                                    <img src="'+item.iconUrl+'" alt="'+item.title+'">\
                                </a>\
                                <div class="tr-main__name">\
                                    <a href="./video-detail.html?id='+item.id+'" target="_blank">'+titleTpl+'</a>\
                                </div>\
                            </div>\
                        </td>\
                        <td>'+item.fansCount+'</td>\
                        <td>'+item.avgReadCount+'</td>\
                        <td>'+((item.price1 == -1) ? '无' : item.price1)+'</td>\
                        <td>'+((item.price2 == -1) ? '无' : item.price2)+'</td>\
                        <td>'+((item.price3 == -1) ? '无' : item.price3)+'</td>\
                        <td>'+dangqi+'</td>\
                        <td>'+openqq+'</td>\
                    </tr>';
        })
        $('[data-role="result4"]').html(tpl);
    },

    getList5: function() {
        $.ajax({
            url: window.domain + window.requestUrl.getCompanyPlatUrl,
            type: 'get',
            data: {
                pageSize: pageSize,
                platId: 1,
                uid: uid
            },
            xhrFields: {
                withCredentials: true
            },
            crossDomain: true,
            success: function(res) {
                if(typeof(res.not_login) != 'undefined') {
                    window.setCookie('go_back_link', window.location.href);
                    window.location.href = './login.html';
                    return;
                }
                if(res.status) {
                    var pager = res.data.result;
                    company.initPaging5(pager.pages, pager.total, res);
                    $('.company-tab li').eq(4).find('span').html(pager.total);
                } else {
                    iosOverlay({
                        text: res.msg,
                        duration: 1000
                    });
                }
            },
            error: function(e) {
            }
        })
    },
    initPaging5: function(totalPage, totalDataNum, res) {
        var self = this,
            ele = $('[data-role="dirPaging5"]');
            if(totalDataNum > 0) {
                ele.show();
                var pagination = ele.pagination(totalDataNum, {
                    num_edge_entries: 1,
                    num_display_entries: 4,
                    callback: function(page_index) {
                        if(page_index == 0) {
                            var totalPage = res.data.result.pages;

                            var pageData = res.data.result.list;
                            var result = res.data.result;
                            company.randerList5(pageData);
                        } else {
                            curPage5 = page_index + 1;
                            company.getPageDates5();
                        }
                    },
                    items_per_page: pageSize,
                    prev_text: "&lt;&lt;上一页",
                    next_text: "下一页&gt;&gt;",
                    link_to: "javascript:;"
                });

            }else {
                ele.hide();
                $('[data-role="result5"]').html('<tr><td  colspan="7" style="text-align: center;line-height: 100px;font-size: 18px;">没有数据</td></tr>')
            }
    },
    getPageDates5: function() {
        var self = this;

        $.ajax({
            url: window.domain + window.requestUrl.getCompanyPlatUrl,
            type: 'get',
            data: {
                pageNum: curPage5,
                pageSize: pageSize,
                platId: 1,
                uid: uid
            },
            xhrFields: {
                withCredentials: true
            },
            crossDomain: true,
            success: function(res) {
                if(typeof(res.not_login) != 'undefined') {
                    window.setCookie('go_back_link', window.location.href);
                    window.location.href = './login.html';
                    return;
                }

                // 同步页码
                var totalPage = res.data.result.pages;

                var pageData = res.data.result.list;
                var result = res.data.result;
                self.randerList5(pageData);
            },
            error: function() {
                // console.log('分页接口失败');
            }
        });
    },
    randerList5: function(pageData) {
        var tpl = '';

        $.each(pageData, function(index, item) {
            var titleTpl = '';
            item.tags = JSON.parse(item.tags)
            if(item.tags.length > 0) {
                var tagTpl = '';

                $.each(item.tags, function(indexDir, itemDir) {
                    if(indexDir > 2) return;
                    tagTpl += tagMap[itemDir]+' ';
                })
                titleTpl = '<p>'+item.title+'</p><p class="item-desc">'+tagTpl+'</p>';
            } else {
                titleTpl = '<p style="line-height:50px;">'+item.title+'</p>';
            }
            var dangqi = '';
            if(item.hasFreeSchedInWeek) {
                dangqi = '有';
            } else {
                dangqi = '无';
            }

            var openqq = '';
            if(window.isLogin) {
                openqq = '<a href="tencent://message/?uin='+item.qq+'&Site=yoomeda.com&Menu=yes" target="_blank">\
                            <img src="http://wpa.qq.com/pa?p=2:'+item.qq+':41" alt="点击这里给我发消息" title="点击这里给我发消息">\
                        </a>';
            } else {
                openqq = '<a href="javascript:;" data-role="tologin">\
                            <img src="http://wpa.qq.com/pa?p=2:'+item.qq+':41" alt="点击这里给我发消息" title="点击这里给我发消息">\
                        </a>';
            }
            tpl += '<tr>\
                        <td>\
                            <div class="tr-main">\
                                <a href="./headline-detail.html?id='+item.id+'" target="_blank">\
                                    <img src="'+item.iconUrl+'" alt="'+item.title+'">\
                                </a>\
                                <div class="tr-main__name">\
                                    <a href="./headline-detail.html?id='+item.id+'" target="_blank">'+titleTpl+'</a>\
                                </div>\
                            </div>\
                        </td>\
                        <td>'+item.fansCount+'</td>\
                        <td>'+item.avgReadCount+'</td>\
                        <td>'+((item.price1 == -1) ? '无' : item.price1)+'</td>\
                        <td>'+((item.price2 == -1) ? '无' : item.price2)+'</td>\
                        <td>'+dangqi+'</td>\
                        <td>'+openqq+'</td>\
                    </tr>';
        })
        $('[data-role="result5"]').html(tpl);
    },
    loginStatus: function() {
        $.ajax({
            url: window.domain + window.requestUrl.userUrl,
            type: 'get',
            xhrFields: {
                withCredentials: true
            },
            crossDomain: true,
            success: function(res) {
                if(typeof(res.not_login) != 'undefined') {
                    window.setCookie('go_back_link', window.location.href);
                    window.location.href = './login.html';
                    return;
                }
                company.getList1();
                company.getList2();
                company.getList3();
                company.getList4();
                company.getList5();
                if(res.status) {
                    window.isLogin = true;
                } else {
                    window.isLogin = false;
                }
            },
            error: function(e) {
            }
        })
    },
    tologin: function() {
        $(document).on('click', '[data-role="tologin"]', function() {
            iosOverlay({
                text: '请先登录！',
                duration: 1500
            });
        })
    },
    init: function() {
        this.getData();
        this.tab();
        this.loginStatus();
        this.tologin();
    }
}
company.init();
